﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Stone.Components
{
    /// <summary>
    /// 实体可能存在的状态枚举
    /// </summary>
    public enum EntityState
    {
        /// <summary>
        /// 未完全加载的实体(内容不完整)
        /// </summary>
        Unload = -1,

        /// <summary>
        /// 新增实体(未保存)
        /// </summary>
        New = 0,

        /// <summary>
        /// 实体未修改(已保存)
        /// </summary>
        Saved = 1,

        /// <summary>
        /// 实体已修改(保存后被修改)
        /// </summary>
        Changed = 2,

        /// <summary>
        /// 实体被删除
        /// </summary>
        Deleted = 3
    }

    public interface IEntity
    {
        /// <summary>
        /// 实体ID
        /// </summary>
        object EntityKey { get; }

        /// <summary>
        /// 获取EntityState枚举值之一
        /// </summary>
        EntityState EntityState { get; set;}

        /// <summary>
        /// 获取实体类型
        /// </summary>
        EntityType EntityType { get;}
    }

    public interface IEntity<T>
        where T : struct
    {
        /// <summary>
        /// 实体ID
        /// </summary>
        T Id { get; }

    }
}
